/*
 * Copyright (C) 2008-2008 LeGACY <http://www.legacy-project.org/>
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 */

#ifndef __LEGACY_GAMEOBJECT_H
#define __LEGACY_GAMEOBJECT_H

#include "Common.h"
#include "Object.h"
#include "Database/DatabaseEnv.h"

// from `gameobject_template`
struct GameObjectInfo
{
	uint32  id;
	uint32  type;
	char   *name;

	char   *ScriptName;
};

// from `gameobject`
struct GameObjectData
{
	uint32 id;
	uint32 mapid;
	uint16 posX;
	uint16 posY;
	int32  spawntimesecs;
	uint32 go_state;
};

class LEGACY_DLL_SPEC GameObject : public WorldObject
{
	public:
		explicit GameObject( WorldObject *instantiator );
		~GameObject();

		void AddToWorld();
		void RemoveFromWorld();

		bool Create(uint32 guidlow, uint32 name_id, uint32 mapid, uint16 x, uint16 y, uint32 go_state);

		void Update(uint32 p_time);


		bool LoadFromDB(uint32 guid, uint32 InstanceId) {};
		GameObjectInfo const* GetGOInfo() const;

		GridReference<GameObject> &GetGridRef() { return m_gridRef; }
	protected:

	private:
		GridReference<GameObject> m_gridRef;
};
#endif
